<?php
/**
 * Created by PhpStorm.
 * User: alice
 * Date: 2015/12/28
 * Time: 12:26
 */

/**
 * Class Involved_ArticleModel
 */

class Involved_CircleReplyModel extends BaseModel{

    protected $table = 'circle_reply';

    /*************************   APP 接口   *****************************/

    /**
     * 获取定制数量
     * @param $reply_id
     * @return mixed
     * @author alice
     * @date 2016-2-25
     */
    public function GetInquiryNum($reply_id)
    {
        return DB::table($this->table)
            ->where(['reply_id' => $reply_id, 'type' => 1])
            ->count();
    }


    /**
     * 获取报价单列表
     * @param $reply_id
     * @return mixed
     */
    public function GetInquiryList($reply_id)
    {
        return DB::table($this->table)
            ->select('contact','price')
            ->where(['reply_id' => $reply_id, 'type' => 1])
            ->orderBy('created','desc')
            ->get();
    }

    /**
     * 获取定制单回复列表
     * @param $reply_id
     * @return mixed
     */
    public function GetCustomizeInfo($reply_id)
    {
        return DB::table($this->table)
            ->select('contact','number')
            ->where(['reply_id' => $reply_id, 'type' => 3])
            ->orderBy('created','desc')
            ->get();
    }


    /**
     * 获取定制单回复数量
     * @param $reply_id
     * @return mixed
     * @author alice
     * @date 2016-2-25
     */
    public function GetCustomizeNum($reply_id)
    {
        return DB::table($this->table)
            ->where(['reply_id' => $reply_id, 'type' => 3])
            ->count();
    }


    /**
     * 获取供货单回复列表
     * @param $reply_id
     * @return mixed
     */
    public function GetSupplyInfo($reply_id)
    {
        return DB::table($this->table)
            ->select('contact','number')
            ->where(['reply_id' => $reply_id, 'type' => 2])
            ->orderBy('created','desc')
            ->get();
    }


    /**
     * 获取供货单回复数量
     * @param $reply_id
     * @return mixed
     * @author alice
     * @date 2016-2-25
     */
    public function GetSupplyNum($reply_id)
    {
        return DB::table($this->table)
            ->where(['reply_id' => $reply_id, 'type' => 2])
            ->count();
    }










}